<?php

declare(strict_types=1);

namespace app\admin\controller;

use addons\Builder\facade\Builder;
//该文件为自动生成，请按需修改
class UserActivity extends Base
{
    //主键，默认为id
    protected string $pk = 'id';

    //主模型
    protected string $model = '\app\common\model\UserActivity';
    //关联模型
    protected $hasOne = ['user'];

    public function index(): string
    {
        $id = $this->request->get('id');
        $extra_map = [['activity_id', '=', $id]];
        return Builder::Table()

            ->addColumn(['type' => 'checkbox', 'fixed' => 'left', 'title' => '全选'])
            ->addColumn(['field' => 'id', 'title' => '报名ID', 'width' => 90])
            ->addColumn(['field' => 'code', 'title' => '报名会员', 'templet' => '#_userTpl'])
            ->addColumn(['field' => 'rname', 'title' => '姓名'])
            ->addColumn(['field' => 'mobile', 'title' => '手机号'])
            ->addColumn(['field' => 'note', 'title' => '备注'])
            ->addExtraMap($extra_map)
            ->fetch();
    }
}
